<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>  
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<script type="text/javascript" src="/must_go/script/membershipScript/joinScript.js"></script>
<script type="text/javascript" src="/must_go/script/jquery.js"></script>
<script src="http://dmaps.daum.net/map_js_init/postcode.js"></script>

<script type="text/javascript" src="/${initParam.rootPath}/script/script.js"></script>

<h2>내정보 수정</h2>

<form method="post" action="/must_go/membership/modify.do"  onsubmit="return formCheck(this);">
<input type="hidden" name="id" value="${sessionScope.login_info.id }">
	<table width='500'>
		<tr>
			<td>ID</td>
			<td>${sessionScope.login_info.id }</td>
		</tr>
		<tr>
			<td>Password</td>
			<td>
				<input type="password" name="password" id="password" value ="${sessionScope.login_info.password }">
			</td>
		</tr>
		<tr>
			<td>이름</td>
			<td>
				<input type="text" name="name" value="${sessionScope.login_info.name }">
			</td>
		</tr>
		<tr>
			<td>나이</td>
			<td>
				<input type="text" name="age" id="age" value="${sessionScope.login_info.age }">
			</td>
		</tr>
		<tr>
			<td>성별</td>
			<td>
				<c:choose>
					<c:when test="${sessionScope.login_info.gender == '남성'}">
						<input type="radio" name="gender" value="남성" checked="checked">남성 &nbsp;
						<input type="radio" name="gender" value="여성" >여성
					</c:when>
					<c:otherwise>
						<input type="radio" name="gender" value="남성" >남성 &nbsp;
						<input type="radio" name="gender" value="여성" checked="checked">여성
					</c:otherwise>
				</c:choose>
			</td>
		</tr>
		
		<input type="hidden" name="grade" value="일반회원" >
		
		<tr>
			<td>생년월일</td>
			<td>
				<input type="hidden" name="birthDate" id="birthDate">
				
				<select name="year" id="year">
					<option>년도선택</option>
				<c:forEach begin="1900" end="2014" var="year">
					<option ${year == requestScope.year? "selected=selected":"" }>${year }</option>
				</c:forEach>
				</select>
				<select name="month" id="month" onchange="monthChange()">
					<option>월선택</option>
				<c:forEach begin="1" end="12" var="month" >
					<option ${month == requestScope.month? "selected=selected":"" }>${month }</option>
				</c:forEach>
				</select>
				
				<select name="day" id="day">
					<option ${day == requestScope.day? "selected=seleced":"" }>${day }</option>
				</select>
			</td>
		</tr>
	
		<tr>
			<td>이메일</td>
			<td>
				<input type="hidden" id="email" name="email">
				
				<input  type="text" class="form-control2" name="email1" value="${requestScope.email1 }"
						id="email1" onkeyup="emailCheck()" onfocus="emailmsgclear()"> 
						
						@ <input type="text" name="email2" id="email2" onkeyup="emailCheck2()"
						style="width: 80px; height: 20px; border-radius: 4px; border: 1px solid #ccc;" disabled value="${requestScope.email2 }"> 
						<select style="width: 100px; height: 20px" name="selectEmail" id="selectEmail">
						<option value="1">직접입력</option>
						<option value="naver.com"  ${'naver.com' == requestScope.email2? "selected=seleced":"" }>naver.com</option>
						<option value="hanmail.net"  ${'hanmail.net' == requestScope.email2? "selected=seleced":"" }>hanmail.net</option>
						<option value="hotmail.com" ${'hotmail.com' == requestScope.email2? "selected=seleced":"" }>hotmail.com</option>
						<option value="nate.com" ${'nate.com' == requestScope.email2? "selected=seleced":"" }>nate.com</option>
						<option value="yahoo.co.kr" ${'yahoo.co.kr' == requestScope.email2? "selected=seleced":"" }>yahoo.co.kr</option>
						<option value="empas.com" ${'empas.com' == requestScope.email2? "selected=seleced":"" }>empas.com</option>
						<option value="dreamwiz.com" ${'dreamwiz.com' == requestScope.email2? "selected=seleced":"" }>dreamwiz.com</option>
						<option value="freechal.com" ${'freechal.com' == requestScope.email2? "selected=seleced":"" }>freechal.com</option>
						<option value="lycos.co.kr" ${'lycos.co.kr' == requestScope.email2? "selected=seleced":"" }>lycos.co.kr</option>
						<option value="korea.com" ${'korea.com' == requestScope.email2? "selected=seleced":"" }>korea.com</option>
						<option value="gmail.com" ${'gmail.com' == requestScope.email2? "selected=seleced":"" }>gmail.com</option>
						<option value="hanmir.com" ${'hanmir.com' == requestScope.email2? "selected=seleced":"" }>hanmir.com</option>
						<option value="paran.com" ${'paran.com' == requestScope.email2? "selected=seleced":"" }>paran.com</option>
					</select>
					<script type="text/javascript">
						//이메일 입력방식 선택
						$('#selectEmail').change(function() {
							$("#selectEmail option:selected").each(function() {
						
								if ($(this).val() == '1') { //직접입력일 경우
									$("#email2").val(''); //값 초기화
									$("#email2").attr("disabled", false); //활성화
								} else { //직접입력이 아닐경우
									$("#email2").val($(this).text()); //선택값 입력
									$("#email2").attr("disabled", true); //비활성화
								}
							});
						});
					</script>
			</td>
		</tr>
		<tr>
			<td id="email_error" style="color: red;"></td>
		</tr>
	
		<tr>
			<td>전화번호</td>
			<td>
				<select name="homePhone1" id="homePhone1">
					<option ${'02' == requestScope.day? "selected=seleced":"" }>02</option>
					<option ${'031' == requestScope.day? "selected=seleced":"" }>031</option>
					<option ${'032' == requestScope.day? "selected=seleced":"" }>032</option>
					<option ${'033' == requestScope.day? "selected=seleced":"" }>033</option>
					<option ${'041' == requestScope.day? "selected=seleced":"" }>041</option>
					<option ${'042' == requestScope.day? "selected=seleced":"" }>042</option>
					<option ${'043' == requestScope.day? "selected=seleced":"" }>043</option>
					<option ${'051' == requestScope.day? "selected=seleced":"" }>051</option>
					<option ${'052' == requestScope.day? "selected=seleced":"" }>052</option>
					<option ${'053' == requestScope.day? "selected=seleced":"" }>053</option>
					<option ${'054' == requestScope.day? "selected=seleced":"" }>054</option>
					<option ${'055' == requestScope.day? "selected=seleced":"" }>055</option>
					<option ${'061' == requestScope.day? "selected=seleced":"" }>061</option>
					<option ${'062' == requestScope.day? "selected=seleced":"" }>062</option>
					<option ${'063' == requestScope.day? "selected=seleced":"" }>063</option>
					<option ${'064' == requestScope.day? "selected=seleced":"" }>064</option>
					<option ${'070' == requestScope.day? "selected=seleced":"" }>070</option>
				</select>
				-<input type="text" id="homePhone2" name="homePhone2" value="${requestScope.homePhone2 }" onkeyup="checkNum2()" style="width: 60px;">
				-<input type="text" id="homePhone3" name="homePhone3" value="${requestScope.homePhone3 }" onkeyup="checkNum2()" style="width: 60px;">
				
				 <input type="hidden" name="homePhone" id="homePhone">
			</td>
		</tr>
		<tr>
			<td colspan="2" id="homePhone_error" style="color: red;"></td>
		</tr>
	
		<tr>
			<td>휴대폰</td>
			<td>
				<select name="cellPhone1" id="cellPhone1">
					<option ${'010' == requestScope.day? "select=seleced":"" }>010</option>
					<option ${'011' == requestScope.day? "select=seleced":"" }>011</option>
					<option ${'016' == requestScope.day? "select=seleced":"" }>016</option>
					<option ${'017' == requestScope.day? "select=seleced":"" }>017</option>
					<option ${'018' == requestScope.day? "select=seleced":"" }>018</option>
					<option ${'019' == requestScope.day? "select=seleced":"" }>019</option>
				</select>
				-<input type="text" name="cellPhone2" id="cellPhone2" value="${requestScope.cellPhone2 }" onkeyup="checkNum3()" style="width: 60px;">
				-<input type="text" name="cellPhone3" id="cellPhone3" value="${requestScope.cellPhone3 }" onkeyup="checkNum3()" style="width: 60px;">
				 <input type="hidden" name="cellPhone" id="cellPhone">
			</td>
		</tr>
		<tr>
			<td colspan="2" id="cellPhone_error" style="color: red;"></td>
		</tr>
	
		<tr>
			<td>SNS수신여부</td>
			<td>
				<c:choose>
					<c:when test="${sessionScope.login_info.SNSReception == 'Yes'}">
						<input type="radio" name="SNSReception" checked="checked">Yes &nbsp;
						<input type="radio" name="SNSReception">No 
					</c:when>
					<c:otherwise>
						<input type="radio" name="SNSReception" >Yes &nbsp;
						<input type="radio" name="SNSReception" checked="checked">No 
					</c:otherwise>
				</c:choose>
			</td>
		</tr>
	
		<tr>
			<td>email수신여부</td>
			<td>
				<c:choose>
					<c:when test="${sessionScope.login_info.emailReception == 'Yes'}">
						<input type="radio" name="emailReception" checked="checked">Yes &nbsp;
						<input type="radio" name="emailReception">No 
					</c:when>
					<c:otherwise>
						<input type="radio" name="emailReception" >Yes &nbsp;
						<input type="radio" name="emailReception" checked="checked">No 
					</c:otherwise>
				</c:choose>
			</td>
		</tr>


		<tr>
			<td>주소</td>
			<td>
				<input type="button"  onclick="findAddress()" value="우편번호 검색"><br>
				<input type="text"  id="zipCode1" name="zipCode1" value="${requestScope.zipCode1 }">-<input type="text" id="zipCode2" name="zipCode2" value="${requestScope.zipCode2 }">
				<input type="text"  id="addr1" name="addr1" value="${requestScope.addr1 }">&nbsp
				<input type="text" id="addr2" name="addr2" value="${requestScope.addr2 }" placeholder="상세주소입력">
				
				<input type="hidden" name="zipCode" id="zipCode">
				<input type="hidden" name="address" id="address">
			</td>
		</tr>

		<tr> 
			<td colspan="2" >
				<input type="submit" value="수정">
				<input type="reset" value="다시작성">
			</td>
		</tr>
	</table>
</form>
